﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MonsterEngine.Interfaces;
using MonsterEngine.Entities;

namespace MonsterEngine.Managers
{
    public class WorldManager
    {
        private IFightable _player1;
        public IFightable Player1
        {
            get { return _player1; }
            set { _player1 = value; }
        }
        private IFightable _player2;
        public IFightable Player2
        {
            get { return _player2; }
            set { _player2 = value; }
        }
        private FightManager _fightManager;
        public FightManager FightManager;

        public WorldManager()
        {
            RegisterDerived.All();
        }

        public void StartFight()
        {
            bool startFight = true;
            PlayerManager.Player1 = _player1;
            PlayerManager.Player2 = _player2;
            _fightManager = new FightManager();

            while (startFight)
            {
                startFight = DoFight();
            }

            //DBManager
        }

        private bool DoFight()
        {
            _fightManager.DetermineWhoGoesFirst();
            return _fightManager.StartFight();
        }
    }
}
